package com.yang.frost.blueberry.controller;

import com.yang.frost.blueberry.config.annotation.Log;
import com.yang.frost.blueberry.params.LoginParam;
import com.yang.frost.blueberry.util.ApiResult;
import com.yang.frost.blueberry.weixin.exception.WxErrorException;
import com.yang.frost.blueberry.weixin.service.WxMpService;
import com.yang.frost.blueberry.weixin.service.WxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 10296
 * @date 2021/2/18
 * @Description: 微信管理类
 */
@RestController
@RequestMapping("/wxApi")
@Api(value = "微信公众号管理API", tags = {"微信公众号管理"})
public class WxController {

    private Logger logger = LoggerFactory.getLogger(WxController.class);
    @Autowired
    private WxMpService wxMpService;


    @Log("获取微信关注列表")
    @PostMapping("/wxUserList")
    @ApiOperation(value = "微信粉丝列表", notes = "获取微信关注列表")
    public ApiResult userList(HttpServletRequest request, HttpServletResponse response) throws Exception {
        Map<String, Object> resultMap = new HashMap<>(1);
        List<Map<String, Object>> maps = wxMpService.userList(null);
        logger.info(maps + "");
        resultMap.put("rows", maps);
        return ApiResult.ok(resultMap);
    }


}
